package com.ruoyi.web.controller.api;

import com.ruoyi.cat.domain.CatComplaint;
import com.ruoyi.cat.domain.VO.ComplaintVO;
import com.ruoyi.cat.service.ICatComplaintService;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.utils.ImageUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Api(tags = "api-投诉相关接口")
@RestController
@RequestMapping("/api/carousel")
public class ComplaintController extends BaseController {

    @Autowired
    private ICatComplaintService catComplaintService;

    @Autowired
    private ImageUtils imageUtils;

    @ApiOperation("api-新增投诉")
    @PostMapping("addCarousel")
    public AjaxResult add(@RequestBody ComplaintVO catComplaint)
    {
        CatComplaint cat = new CatComplaint();
        cat.setImage(catComplaint.getImage());
        cat.setPhone(catComplaint.getPhone());
        cat.setComplaintOpinion(catComplaint.getComplaintOpinion());
        return toAjax(catComplaintService.insertCatComplaint(cat));
    }



    @GetMapping("getAdd")
    public AjaxResult add()
    {
        String url = imageUtils.generatePrivateDownloadUrl1("https://img12.iqilu.com/10339/clue/202405/29/48ae238e-ff2d-4006-866b-8de0b5e421a5.jpg");
        return success(url);
    }


}
